-
Notifications
You must be signed in to change notification settings - Fork 1.3k
remotecache: Refactor S3 cache backend to use minio-go client
#6200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
528b206 to
37de2b1
Compare
|
cc @bpaquet |
440538d to
12c3dff
Compare
minio-go clientminio-go client
12c3dff to
341f627
Compare
|
Rebased and update to minio 7.0.97 removing a module importing a lot: minio/minio-go@v7.0.95...v7.0.97#diff-ca70b2f0fe15f1fa83771dd5b232679a5db6bd062df5cbd081a5cb14c00d87c8L14 |
|
@bpaquet I think we would like to get this in, unless you have some arguments against it. |
|
cc @azr as well |
|
I had a quick look, seems the client only support static creds. IMHO we should keep a way to use any kind of creds. Standard creds are
From a personal point of view, I think the standard is s3 :) |
|
Question: why not make a minio remotecache ? and sort of slowly deprecate the s3 one, to give people options & time ? It would also make it easy to fix/circumvent any issues and still allow to avoid these pitfalls described up there. Other than that, I don't think I can come up with any strong objection with this. |
|
+1, seems better to do a minio remote cache exporter and mutualize the code |
|
Thanks for the review and for flagging the credential concerns, @bpaquet 🙏
You’re right that the current diff effectively narrows us to static keys. I’m proposing to wire minio-go’s credential chain so we keep parity with common setups (env, shared file, and IAM/IRSA/ECS/IMDS), while preserving explicit static keys as today. Tiny, backward-compatible change: func resolveCredentials(config Config) *credentials.Credentials {
if config.AccessKeyID != "" || config.SecretAccessKey != "" || config.SessionToken != "" {
return credentials.NewStaticV4(config.AccessKeyID, config.SecretAccessKey, config.SessionToken)
}
return credentials.NewChainCredentials([]credentials.Provider{
&credentials.EnvAWS{}, // AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN
&credentials.EnvMinio{}, // MINIO_ACCESS_KEY / MINIO_SECRET_KEY / MINIO_SESSION_TOKEN
&credentials.FileAWSCredentials{}, // ~/.aws/credentials or AWS_SHARED_CREDENTIALS_FILE (+ AWS_PROFILE)
&credentials.IAM{Client: &http.Client{}}, // EC2 IMDS / ECS / IRSA (web identity)
})
}
… and then use it when creating the client: client, err := minio.New(parsedURL.Host, &minio.Options{
Creds: resolveCredentials(config),
Secure: parsedURL.Scheme == "https",
Region: config.Region,
BucketLookup: bucketLookup,
})
Yes, that is of course also a option. Should I create a new pull request with the new cache provider? |
Don't think we want another cache exporter that would increase the binary size with new set of dependencies if there is no real adding-value.
Thanks @sorenhansendk, I think using a default set of credential providers looks good if |
Signed-off-by: Søren Hansen <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
341f627 to
008558b
Compare
| Creds: credentials.NewChainCredentials([]credentials.Provider{ | ||
| &credentials.Static{ | ||
| Value: credentials.Value{ | ||
| AccessKeyID: config.AccessKeyID, | ||
| SecretAccessKey: config.SecretAccessKey, | ||
| SessionToken: config.SessionToken, | ||
| SignerType: credentials.SignatureV4, | ||
| }, | ||
| }, | ||
| &credentials.EnvAWS{}, | ||
| &credentials.EnvMinio{}, | ||
| &credentials.FileAWSCredentials{}, | ||
| &credentials.IAM{}, | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed extra commit to support multiple credential providers
PTAL @bpaquet @azr @sorenhansendk
In the use cases I've seen, binary size really doesn't matter as the image would be cached, plus bandwidth and storage are cheap, etc. and this wouldn't be such a big increase. Also, this would be temporary, until we remove the s3 lib. Moreover, isn't the s3 lib used elsewhere ? The annoying cost would be a maintain cost, I think, and there I hear you, that's a bigger burden than it should. The added value would be the stability here, I don't know that there is a bug but a few discrepancies were found already, etc. |
The MinIO SDK is designed to talk to any S3-compatible object storage, and the project actively maintains interoperability across providers. This directly addresses the signature/header edge cases we’ve hit with S3-compatible endpoints (e.g., checksum and Accept-Encoding interactions)
Why
What changes
Closes: #3749 (minio-go works with GCS via HMAC)
Closes: #5804 (minio-go works with OpenStack S3)
Closes: #4487 (minio-go works with Alibaba Cloud)